home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / plugin.jar / netscape / security / Privilege.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.4 KB  |  88 lines

  1. package netscape.security;
  2.  
  3. public final class Privilege {
  4.    public static final int N_PERMISSIONS = 15;
  5.    public static final int FORBIDDEN = 0;
  6.    public static final int ALLOWED = 1;
  7.    public static final int BLANK = 2;
  8.    public static final int N_DURATIONS = 240;
  9.    public static final int SCOPE = 16;
  10.    public static final int SESSION = 32;
  11.    public static final int FOREVER = 64;
  12.    private int permission = 0;
  13.    private int duration = 16;
  14.  
  15.    Privilege(int var1, int var2) {
  16.       this.permission = var1;
  17.       this.duration = var2;
  18.    }
  19.  
  20.    public static Privilege findPrivilege(int var0, int var1) {
  21.       return new Privilege(var0, var1);
  22.    }
  23.  
  24.    public static int add(int var0, int var1) {
  25.       if (var0 != 0 && var1 != 0) {
  26.          if (var0 == 2) {
  27.             return var1;
  28.          } else if (var1 == 2) {
  29.             return var0;
  30.          } else {
  31.             return var0 != 1 && var1 != 1 ? 2 : 1;
  32.          }
  33.       } else {
  34.          return 0;
  35.       }
  36.    }
  37.  
  38.    public static Privilege add(Privilege var0, Privilege var1) {
  39.       int var2 = add(var0.getPermission(), var1.getPermission());
  40.       return new Privilege(var2, var0.getDuration());
  41.    }
  42.  
  43.    public boolean samePermission(Privilege var1) {
  44.       return this.samePermission(var1.getPermission());
  45.    }
  46.  
  47.    public boolean samePermission(int var1) {
  48.       return this.permission == var1;
  49.    }
  50.  
  51.    public boolean sameDuration(Privilege var1) {
  52.       return this.sameDuration(var1.getDuration());
  53.    }
  54.  
  55.    public boolean sameDuration(int var1) {
  56.       return this.duration == var1;
  57.    }
  58.  
  59.    public boolean isAllowed() {
  60.       return this.permission == 1;
  61.    }
  62.  
  63.    public boolean isForbidden() {
  64.       return this.permission == 0;
  65.    }
  66.  
  67.    public boolean isBlank() {
  68.       return this.permission == 2;
  69.    }
  70.  
  71.    public int getPermission() {
  72.       return this.permission;
  73.    }
  74.  
  75.    public int getDuration() {
  76.       return this.duration;
  77.    }
  78.  
  79.    public boolean equals(Object var1) {
  80.       if (!(var1 instanceof Privilege)) {
  81.          return false;
  82.       } else {
  83.          Privilege var2 = (Privilege)var1;
  84.          return this.permission == var2.getPermission() && this.duration == var2.getDuration();
  85.       }
  86.    }
  87. }
  88.